package com.woniuxy.mapper;

import java.util.List;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.woniuxy.entity.Area;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.entity.Area;
@Mapper
public interface AreaMapper {

	//查询所有区域信息
	@Select("select * from t_area1")
	public List<Area> findAllArea(); 
	
	@Select("select aname from t_area")
	public List<Area> findArea();
	
	//新增一条区域信息
	@Insert("insert into t_area1(aid,aname,status,atime,description) values(default,#{aname},#{status},#{atime},#{description})")
	public int addArea(Area area);
	
	//根据状态查询区域信息
	@Select("select * from t_area1 where status=#{status}")
	public List<Area> findAreaByStatus(int status);
	
	//模糊查询
	@Select("select * from t_area1 where aname like CONCAT('%',#{name},'%')")
	public List<Area> findAreaByAname(String name);
	
	//删除操作
	@Delete("delete from t_area1 where aid=#{aid}")
	public int delectAreaByaid(int aid);
	
	//改switch状态
	@Update("update t_area1 set status=#{status} where aid=#{aid}")
	public int updateSwitch(Area area);
	

}
